﻿using System;
using System.Collections.Generic;
using UnityEngine;

// Token: 0x020002A6 RID: 678
public static class EventManager
{
	// Token: 0x06000F1F RID: 3871 RVA: 0x000739EC File Offset: 0x00071BEC
	public static Listener Register(IListener listener, string interest)
	{
		Listener listener2 = new Listener(listener, interest);
		EventManager.listeners.Add(listener2);
		return listener2;
	}

	// Token: 0x06000F20 RID: 3872 RVA: 0x00073A0D File Offset: 0x00071C0D
	public static void Unregister(Listener registration)
	{
		EventManager.listeners.Remove(registration);
	}

	// Token: 0x06000F21 RID: 3873 RVA: 0x00073A1C File Offset: 0x00071C1C
	public static void SendEvent(IEvent e)
	{
		foreach (Listener listener in EventManager.listeners)
		{
			if (listener.listener == null)
			{
				Debug.LogError("One listener is null, please remove from the list");
			}
			if (e.code == listener.interestCode)
			{
				listener.listener.OnNotify(e);
			}
		}
	}

	// Token: 0x06000F22 RID: 3874 RVA: 0x00073AA8 File Offset: 0x00071CA8
	public static void Clear()
	{
		EventManager.listeners.Clear();
	}

	// Token: 0x0400141A RID: 5146
	private static List<Listener> listeners = new List<Listener>();
}
